<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>OA协同办公系统</title>
		<link href="css/table.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<script src="js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
		<style type="text/css">
.div_allinline {
	text-align: left;
	margin: 0 auto;
	padding: 0;
	clear: both;
}

.subdiv_allinline {
	margin: 10px 10px 0pt 0pt;
	padding: 0;
	display: inline-block;
	_display: inline; *
	display: inline;
	zoom: 1;
}
</style>
		<script type="text/javascript">
			 $(function(){
				$("#tip").html("关键字为空默认搜索全部！");
			  	var name=$("#entityName").val();
			  	var arr=$("#search").find("a");
			  	for(var i=0;i<arr.length;i++){
			  		if(name==arr[i].id){
			  			$("#"+arr[i].id).attr("style","color: black;font-size: 14px;font-weight:bold");
			  			break;
			  		}
			  	}
			  });
			  function getFields(columnValue){
			  		window.location.href="getFieldsByDTO.action?searchDTO.entityName="+columnValue;
			  }
			  function query(){
					var count=0;
					var checks=$("input[id='ids']");
					for(var i=0;i<checks.length;i++){
						if(checks[i].checked){
							count++;
						}
					}
					var content =$("#content").val();
					if(count==0&&content!=''){
						alert("请选择要匹配的字段！");
						return;
					}
					document.search.submit();
					
			  }
			  function checkAll(){
					var all=$("#all");
					var checks=$("input[id='ids']");
					if(all.attr("checked")){
						checks.attr("checked","checked");
					}else{
						checks.attr("checked","");
					}
			  }
		</script>
	</head>
	<body>
		<table align="left" border="0" cellpadding="0" cellspacing="0"
			width="90%">
			<tbody>
				<tr class="noprint">
					<td background="image/wsoa_window_002.gif" width="1"></td>
					<td background="image/wsoa_window_002.gif">
						<table border="0" cellpadding="0" cellspacing="0">
							<tbody>
								<tr>
									<td align="center" background="image/wsoa_window_002.gif"
										width="10">
										<img src="image/center_19.gif">
									</td>
									<td align="center" background="image/wsoa_window_002.gif">
										<span class="tfont12"></span>
									</td>
									<td>高级检索</td>
								</tr>
							</tbody>
						</table>
					</td>
					<td background="image/wsoa_window_002.gif" width="1"></td>
				</tr>
				<tr>
					<td background="image/wsoa_window_010.gif" width="1">
						&nbsp;
					</td>
					<td align="left">
						<form action="getFieldsByDTO.action" name="entityForm"
							method="post">
							<div id="search" class="div_allinline"
								style="margin-top: 5px; height: auto;">
								<c:forEach items="${columns}" var="column">
									<div class="subdiv_allinline">
										<div>
											<c:if test="${column.isAble=='0'}">
												<a id="${column.columnValue }"
													href="javascript:getFields('${column.columnValue }')">${column.columnName
													}</a>
											</c:if>
											<c:if test="${column.isAble=='1'}">
												<a id="${column.columnValue }" disabled='true'
													href="javascript:getFields('${column.columnValue }')">${column.columnName
													}</a>
											</c:if>
										</div>
									</div>
								</c:forEach>
							</div>
						</form>
						<form action="doSearch.action" name="search" method="post">
							<input id="entityName" type="hidden" name="searchDTO.entityName" value="${searchDTO.entityName }">
							<input id="content" type="text" style="width: 500px; height: 18px" maxlength="30" title="最多不超过30个字符" name="searchDTO.searchContent">
							&nbsp;&nbsp;
							<input class="button_04" type="button" value="搜索一下" onclick="query()">
							<br>
							<font id="tip" class="subdiv_allinline" style="color: darkgray; font-size: 12px">&nbsp;</font>
							<div class="div_allinline" style="margin-top: 5px; border: #cccccc 1px double; width:720px; float: left; height: 70px">
								<div class="subdiv_allinline"> 
								&nbsp;<input type="checkbox" id="all" onclick="checkAll()" />全选
										<c:forEach items="${fields}" var="field">
											<c:if test="${field.type=='checkbox'}">
												<input id="ids" name="searchDTO.columnNames" type="checkbox" value="${field.fieldValue }"> ${field.fieldName}
											</c:if>
											<c:if test="${field.type=='time'}">
												<div style="float: left; margin-top: 5px">
													搜索时间从：
													<input name="startDate" value="${startDate }" class="Wdate"
														id="startTime1" type="text" readonly="readonly"
														onclick="WdatePicker({maxDate:'#F{$dp.$D(\'startTime2\',{d:-0});}'})"
														id="startTime1" />
													&nbsp;&nbsp; 到：
													<input name="endDate" value="${endDate}" class="Wdate"
														id="startTime2" type="text" readonly="readonly"
														onclick="WdatePicker({minDate:'#F{$dp.$D(\'startTime1\',{d:0});}'})"
														id="startTime2" />
												</div>
											</c:if>
											<div style="float:left;line-height: 32px;">
												<c:if test="${field.type=='selectPublish'}">
											&nbsp;&nbsp;&nbsp;&nbsp;${field.fieldName}
												<select name="publish">
														<option value="-1">
															请选择
														</option>
														<option value="0">
															未审核
														</option>
														<option value="1">
															已审核
														</option>
													</select>
												</c:if>
												<c:if test="${field.type=='selectIfRead'}">
											&nbsp;&nbsp;&nbsp;&nbsp;${field.fieldName}
												<select name="ifRead">
														<option value="-1">
															请选择
														</option>
														<option value="0">
															未读
														</option>
														<option value="1">
															已读
														</option>
													</select>
												</c:if>
											</div>
										</c:forEach>
								</div>
							</div>
						</form>
					</td>
					<td background="image/wsoa_window_006.gif" width="1">
						&nbsp;
					</td>
				</tr>
				<tr class="noprint">
					<td height="1" width="1">
						<img src="image/wsoa_window_009.gif" height="16" width="14">
					</td>
					<td background="image/wsoa_window_008.gif" height="1"></td>
					<td height="1" width="1">
						<img src="image/wsoa_window_007.gif" height="16" width="12">
					</td>
				</tr>
			</tbody>
		</table>
	</body>
</html>